package com.freesky.biz.abchina.controller;

import com.freesky.biz.abchina.api.AbChinaCoupon;
import com.freesky.biz.abchina.domain.TBindDemo;
import com.freesky.biz.abchina.domain.TElevenRecord;
import com.freesky.biz.abchina.service.IBindDemoService;
import com.freesky.biz.abchina.service.IElevenRecordService;
import com.freesky.common.annotation.Log;
import com.freesky.common.core.controller.BaseController;
import com.freesky.common.core.domain.AjaxResult;
import com.freesky.common.core.page.TableDataInfo;
import com.freesky.common.enums.BusinessType;
import com.freesky.common.exception.CustomException;
import com.freesky.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/abchina/binddemo/")
public class BindDemoController extends BaseController {

    @Autowired
    private IBindDemoService bindDemoService;

    @PreAuthorize("@ss.hasPermi('abchina:binddemo:list')")
    @GetMapping("/list")
    public TableDataInfo list(TBindDemo bindDemo) {
        startPage();
        List<TBindDemo> list = bindDemoService.findList(bindDemo);
        return getDataTable(list);
    }

    @Log(title = "邮储支付享好礼", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('abchina:binddemo:export')")
    @GetMapping("/export")
    public AjaxResult export(TBindDemo bindDemo,
                             HttpServletResponse response) {
        return bindDemoService.exportFile(bindDemo);
    }
}
